-
-
Notifications
You must be signed in to change notification settings - Fork 269
Use FFI/JNI for captureEnvelope
on iOS and Android
#3115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: deps/bump-ffigen
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## deps/bump-ffigen #3115 +/- ##
====================================================
- Coverage 89.85% 89.61% -0.25%
====================================================
Files 96 96
Lines 3431 3448 +17
====================================================
+ Hits 3083 3090 +7
- Misses 348 358 +10 ☔ View full report in Codecov by Sentry. |
iOS Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
2cb90b9 | 1272.90 ms | 1285.55 ms | 12.66 ms |
dbd526b | 1244.78 ms | 1259.02 ms | 14.24 ms |
81f83eb | 1259.53 ms | 1273.39 ms | 13.86 ms |
73dca78 | 1246.65 ms | 1265.42 ms | 18.76 ms |
6b69699 | 1254.80 ms | 1273.31 ms | 18.52 ms |
f761369 | 1261.69 ms | 1277.82 ms | 16.12 ms |
640ad0c | 1241.04 ms | 1253.96 ms | 12.92 ms |
7cfbbd6 | 1270.63 ms | 1285.36 ms | 14.72 ms |
e45c0e1 | 1269.08 ms | 1278.83 ms | 9.75 ms |
cc4e375 | 1253.06 ms | 1263.81 ms | 10.75 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
2cb90b9 | 7.86 MiB | 9.54 MiB | 1.69 MiB |
dbd526b | 7.86 MiB | 9.44 MiB | 1.58 MiB |
81f83eb | 7.86 MiB | 9.44 MiB | 1.58 MiB |
73dca78 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
6b69699 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
f761369 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
640ad0c | 7.86 MiB | 9.44 MiB | 1.58 MiB |
7cfbbd6 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
e45c0e1 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
cc4e375 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
Previous results on branch: enh/ffi-jni-capture-envelope
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
4d265af | 1274.31 ms | 1284.55 ms | 10.24 ms |
8243b86 | 1256.24 ms | 1268.31 ms | 12.06 ms |
5fa2e5f | 1233.29 ms | 1237.04 ms | 3.75 ms |
fcdc0a0 | 1270.39 ms | 1282.24 ms | 11.86 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
4d265af | 7.86 MiB | 9.45 MiB | 1.59 MiB |
8243b86 | 7.86 MiB | 9.45 MiB | 1.59 MiB |
5fa2e5f | 7.86 MiB | 9.45 MiB | 1.59 MiB |
fcdc0a0 | 7.86 MiB | 9.45 MiB | 1.59 MiB |
Android Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
eca355d | 485.50 ms | 569.85 ms | 84.35 ms |
6f47800 | 451.04 ms | 509.64 ms | 58.60 ms |
2cf9161 | 454.12 ms | 512.67 ms | 58.55 ms |
cc4e375 | 426.15 ms | 482.34 ms | 56.19 ms |
793f4dc | 462.68 ms | 544.21 ms | 81.53 ms |
b6c8720 | 457.41 ms | 519.04 ms | 61.63 ms |
3615e19 | 468.38 ms | 504.71 ms | 36.33 ms |
575ebaa | 478.00 ms | 585.76 ms | 107.76 ms |
2d34233 | 470.54 ms | 558.90 ms | 88.36 ms |
9b99523 | 456.91 ms | 490.55 ms | 33.64 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
eca355d | 6.54 MiB | 7.70 MiB | 1.16 MiB |
6f47800 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
2cf9161 | 6.54 MiB | 7.70 MiB | 1.16 MiB |
cc4e375 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
793f4dc | 6.54 MiB | 7.69 MiB | 1.15 MiB |
b6c8720 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
3615e19 | 6.54 MiB | 7.70 MiB | 1.16 MiB |
575ebaa | 6.54 MiB | 7.69 MiB | 1.15 MiB |
2d34233 | 6.54 MiB | 7.55 MiB | 1.01 MiB |
9b99523 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
Previous results on branch: enh/ffi-jni-capture-envelope
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
8243b86 | 480.34 ms | 499.35 ms | 19.01 ms |
5fa2e5f | 508.60 ms | 556.53 ms | 47.93 ms |
fcdc0a0 | 504.15 ms | 536.24 ms | 32.09 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
8243b86 | 6.54 MiB | 7.71 MiB | 1.17 MiB |
5fa2e5f | 6.54 MiB | 7.71 MiB | 1.17 MiB |
fcdc0a0 | 6.54 MiB | 7.71 MiB | 1.17 MiB |
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
// Use a safe copy-based conversion to avoid crashes due to memory issues observed | ||
// when relying on `dataWithBytesNoCopy:length:freeWhenDone:`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you be more specific about what memory issues you've faced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vaind it always crashed when using withBytesNoCopy and freeWhenDone set to true (or set to false and manually freeing)
it seemed to be a bug with the current generated ffigen, the new bindings with ffigen 19.0.0 dont have that issue so we can safely use dataWithBytesNoCopy
, from manual testing it works fine
Step towards #1444
💚 How did you test it?
It's currently hard to mock JNI/FFI calls so we'll be relying on integration tests and verifying that method channel calls are not made anymore for
captureEnvelope
Performance improvement is marginal but an improvement nonetheless
iOS:
FFI calls (26 samples):
Average ≈ 2 967.4 microseconds
Channel calls (25 samples):
Average ≈ 3 264.5 microseconds
Android:
JNI calls (33 samples):
Average ≈ 1 012.8 microseconds
Channel calls (32 samples):
Average ≈ 1 462.5 microseconds
📝 Checklist
sendDefaultPii
is enabled🔮 Next steps
@sentry review